package net.wanho.shop.vo;

import lombok.Data;

/**
 * Author：汤小洋
 * Date：2024-08-06 14:09
 * Description：<描述>
 */
@Data
public class AjaxResult {
    // 状态码
    private Integer status;
    // 消息
    private String msg;
    // 数据
    private Object data;

    public static AjaxResult success(){
        AjaxResult result = new AjaxResult();
        result.setStatus(200);
        result.setMsg("success");
        return result;
    }

    public static AjaxResult success(String msg){
        AjaxResult result = new AjaxResult();
        result.setStatus(200);
        result.setMsg(msg);
        return result;
    }

    public static AjaxResult success(Object data){
        AjaxResult result = new AjaxResult();
        result.setStatus(200);
        result.setMsg("success");
        result.setData(data);
        return result;
    }

    public static AjaxResult error(String msg){
        AjaxResult result = new AjaxResult();
        result.setStatus(500);
        result.setMsg(msg);
        return result;
    }
}
